package com.oritsh.dicom.utils.adaptor;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;

import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.dcm4che.data.Attributes;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: zarra
 * Date: 14-2-5
 * Time: 下午5:18
 * Copyright Shanghai Orient Rain Information Technology Co.,Ltd.
 */
public class AttributesJacksonSerializer extends JsonSerializer<Attributes>{

    @Override
    public void serialize(Attributes value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
        jgen.writeObject(JsonAdaptorHelper.attributesToMap(value));
    }
}
